package com.tengju.data.infrastructure.repository.clickhouse.crm;

import com.tengju.data.domain.model.clickhouse.brand.BrandMarketSortInfo;
import com.tengju.data.domain.model.clickhouse.brand.BrandMarketSortRepository;
import com.tengju.data.infrastructure.persistence.mybatis.dataobject.BrandMarketSortDO;
import com.tengju.data.infrastructure.persistence.mybatis.mapper.clickhouse.crm.BrandMarketSortMapper;
import com.tengju.data.infrastructure.repository.clickhouse.convert.BrandMarketSortConvert;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;
import java.util.List;

/**
 * 
 * @Date: 2021/5/11 21:12
 * @Description: 
 */

@Repository
@Slf4j
@RequiredArgsConstructor(onConstructor_ = {@Autowired})
public class BrandMarketSortRepositoryImpl implements BrandMarketSortRepository {

    private final BrandMarketSortMapper brandMarketSortMapper;

    @Override
    public List<BrandMarketSortInfo> getKABrandMarketSort(List<Long> idCodeList, Integer dateType, BigDecimal minGmv, BigDecimal maxGmv,
                                                          String currentMonthDate, String lastMonthDate,List<String> quarterMonthList,
                                                          String orderColumn,String orderType,
                                                          int offset, int limit) {
        List<BrandMarketSortDO> doList = brandMarketSortMapper.getBrandMarketSort(idCodeList, dateType,
                minGmv, maxGmv,currentMonthDate,lastMonthDate,quarterMonthList,
                orderColumn,orderType,
                offset, limit);
        return BrandMarketSortConvert.toModelList(doList);
    }

    @Override
    public List<BrandMarketSortInfo> getSECBrandMarketSort(List<Long> idCodeList, Integer dateType, BigDecimal minGmv, BigDecimal maxGmv,
                                                           String currentMonthDate, String lastMonthDate,List<String> quarterMonthList,
                                                           String orderColumn,String orderType,
                                                           int offset, int limit) {
        List<BrandMarketSortDO> doList = brandMarketSortMapper.getBrandMarketSort(idCodeList,dateType,
                minGmv,maxGmv,currentMonthDate,lastMonthDate,quarterMonthList,
                orderColumn,orderType,
                offset,limit);
        return BrandMarketSortConvert.toModelList(doList);
    }

    @Override
    public int getKABrandMarketCount(List<Long> idCodeList, Integer dateType, BigDecimal minGmv, BigDecimal maxGmv,
                                     String currentMonthDate, String lastMonthDate,List<String> quarterMonthList) {
        int count = brandMarketSortMapper.getBrandMarketCount(idCodeList,dateType,minGmv,maxGmv,currentMonthDate,lastMonthDate,quarterMonthList);
        return count;
    }

    @Override
    public int getSECBrandmarketCount(List<Long> idCodeList, Integer dateType, BigDecimal minGmv, BigDecimal maxGmv,String currentMonthDate,
                                      String lastMonthDate,List<String> quarterMonthList) {
        int count = brandMarketSortMapper.getBrandMarketCount(idCodeList,dateType,minGmv,maxGmv,currentMonthDate,lastMonthDate,quarterMonthList);
        return count;
    }
}
